package flc.ast.adapter;

import android.text.TextUtils;
import android.view.View;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.StringUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.SelectFileBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ContactsRecordAdapter extends StkProviderMultiAdapter<SelectFileBean> {

    public ContactsRecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new ContactsRecrodProvider());
    }

    private class ContactsRecrodProvider extends BaseItemProvider<SelectFileBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_contacts_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, SelectFileBean bean) {
            if (!TextUtils.isEmpty(bean.getName())) {
                baseViewHolder.setText(R.id.tvContactsRecordItemName, bean.getName());
            } else {
                baseViewHolder.setText(R.id.tvContactsRecordItemName, R.string.not_have_name_text);
            }
            baseViewHolder.setText(R.id.tvContactsRecordItemPhone, bean.getPath());
        }
    }


}
